<template>
  <div class="home-page">
    <header class="hero-section">
      <div class="container">
        <h1>欢迎来到我们的平台</h1>
        <p>提供高品质产品与卓越服务</p>
        <router-link to="/products" class="btn-primary">浏览产品</router-link>
      </div>
    </header>

    <section class="advantages-section">
      <div class="container">
        <h2>平台优势</h2>
        <div class="advantages-grid">
          <div class="advantage-item">
            <div class="advantage-icon">
              <svg width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
              </svg>
            </div>
            <h3>高品质保证</h3>
            <p>所有产品经过严格质量检测，确保卓越品质</p>
          </div>
          <div class="advantage-item">
            <div class="advantage-icon">
              <svg width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <path d="M20.42 4.58a5.4 5.4 0 0 0-7.65 0l-.77.78-.77-.78a5.4 5.4 0 0 0-7.65 0C1.46 6.7 1.33 10.28 4 13l8 8 8-8c2.67-2.72 2.54-6.3.42-8.42z"></path>
              </svg>
            </div>
            <h3>优质服务</h3>
            <p>专业客服团队提供7*24小时贴心服务</p>
          </div>
          <div class="advantage-item">
            <div class="advantage-icon">
              <svg width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <circle cx="12" cy="12" r="10"></circle>
                <polyline points="12 6 12 12 16 14"></polyline>
              </svg>
            </div>
            <h3>快速配送</h3>
            <p>全国覆盖的物流网络，确保快速送达</p>
          </div>
          <div class="advantage-item">
            <div class="advantage-icon">
              <svg width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <path d="M12 2L2 7l10 5 10-5-10-5z"></path>
                <path d="M2 17l10 5 10-5"></path>
                <path d="M2 12l10 5 10-5"></path>
              </svg>
            </div>
            <h3>多样化选择</h3>
            <p>丰富的产品品类，满足不同用户需求</p>
          </div>
        </div>
      </div>
    </section>

    <section class="featured-products-section">
      <div class="container">
        <h2>精选产品</h2>
        <div class="products-grid">
          <div class="product-item" v-for="product in featuredProducts" :key="product.id">
            <router-link :to="`/products/${product.id}`">
              <div class="product-image">
                <img :src="product.image" :alt="product.name" />
              </div>
              <div class="product-info">
                <h3>{{ product.name }}</h3>
                <p class="product-price">¥{{ product.price }}</p>
              </div>
            </router-link>
          </div>
        </div>
        <div class="text-center mt-6">
          <router-link to="/products" class="btn-secondary">查看全部产品</router-link>
        </div>
      </div>
    </section>

    <section class="testimonials-section">
      <div class="container">
        <h2>用户评价</h2>
        <div class="testimonials-grid">
          <div class="testimonial-item" v-for="testimonial in testimonials" :key="testimonial.id">
            <div class="testimonial-content">
              <p>{{ testimonial.content }}</p>
              <div class="testimonial-author">
                <p class="author-name">{{ testimonial.author }}</p>
                <p class="author-role">{{ testimonial.role }}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <section class="cta-section">
      <div class="container text-center">
        <h2>了解更多关于我们的平台</h2>
        <p>探索我们的服务和理念</p>
        <router-link to="/about" class="btn-primary">了解详情</router-link>
      </div>
    </section>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const featuredProducts = ref([
  {
    id: 1,
    name: '智能手表',
    price: 1299,
    image: 'https://picsum.photos/id/1/400/400'
  },
  {
    id: 2,
    name: '无线耳机',
    price: 899,
    image: 'https://picsum.photos/id/2/400/400'
  },
  {
    id: 3,
    name: '智能音箱',
    price: 699,
    image: 'https://picsum.photos/id/3/400/400'
  }
])

const testimonials = ref([
  {
    id: 1,
    content: '这个平台的产品质量非常好，服务也很到位，我已经是老客户了。',
    author: '张先生',
    role: '企业客户'
  },
  {
    id: 2,
    content: '第一次在这里购买产品，体验非常棒，物流也很快，会继续支持！',
    author: '李女士',
    role: '个人用户'
  },
  {
    id: 3,
    content: '平台上的产品种类丰富，价格也很实惠，推荐给大家！',
    author: '王先生',
    role: '忠实用户'
  }
])
</script>

<style scoped>
.home-page {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}

.hero-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 100px 0;
  text-align: center;
}

.hero-section h1 {
  font-size: 2.8rem;
  margin-bottom: 20px;
}

.hero-section p {
  font-size: 1.2rem;
  margin-bottom: 30px;
}

.advantages-section {
  padding: 80px 0;
  background-color: #f8f9fa;
}

.advantages-section h2 {
  text-align: center;
  margin-bottom: 50px;
  font-size: 2.2rem;
  color: #333;
}

.advantages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.advantage-item {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.advantage-icon {
  margin-bottom: 20px;
  color: #667eea;
}

.advantage-item h3 {
  margin-bottom: 15px;
  font-size: 1.3rem;
  color: #333;
}

.advantage-item p {
  color: #666;
  line-height: 1.6;
}

.featured-products-section {
  padding: 80px 0;
}

.featured-products-section h2 {
  text-align: center;
  margin-bottom: 50px;
  font-size: 2.2rem;
  color: #333;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.product-item {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.product-item:hover {
  transform: translateY(-5px);
}

.product-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-info {
  padding: 20px;
}

.product-info h3 {
  margin-bottom: 10px;
  font-size: 1.2rem;
  color: #333;
}

.product-price {
  color: #667eea;
  font-weight: bold;
  font-size: 1.1rem;
}

.testimonials-section {
  padding: 80px 0;
  background-color: #f8f9fa;
}

.testimonials-section h2 {
  text-align: center;
  margin-bottom: 50px;
  font-size: 2.2rem;
  color: #333;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.testimonial-item {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.testimonial-content p {
  margin-bottom: 20px;
  color: #666;
  line-height: 1.6;
  font-style: italic;
}

.author-name {
  font-weight: bold;
  color: #333;
}

.author-role {
  color: #999;
  font-size: 0.9rem;
}

.cta-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 80px 0;
}

.cta-section h2 {
  margin-bottom: 20px;
  font-size: 2rem;
}

.cta-section p {
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 12px 30px;
  border-radius: 30px;
  font-weight: bold;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-primary {
  background-color: white;
  color: #667eea;
  border: 2px solid white;
}

.btn-primary:hover {
  background-color: transparent;
  color: white;
}

.btn-secondary {
  background-color: transparent;
  color: #667eea;
  border: 2px solid #667eea;
}

.btn-secondary:hover {
  background-color: #667eea;
  color: white;
}

.text-center {
  text-align: center;
}

.mt-6 {
  margin-top: 24px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .hero-section h1 {
    font-size: 2.2rem;
  }
  
  .advantages-section h2,
  .featured-products-section h2,
  .testimonials-section h2 {
    font-size: 1.8rem;
  }
  
  .cta-section h2 {
    font-size: 1.6rem;
  }
}
</style>